home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / pff1_3 / pffdisp.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  4.2 KB  |  140 lines

  1. VERSION 2.00
  2. Begin Form Viewer 
  3.    BackColor       =   &H00808080&
  4.    Caption         =   "PFF Display"
  5.    ClientHeight    =   5760
  6.    ClientLeft      =   165
  7.    ClientTop       =   720
  8.    ClientWidth     =   9480
  9.    ControlBox      =   0   'False
  10.    FontBold        =   0   'False
  11.    FontItalic      =   0   'False
  12.    FontName        =   "MS Sans Serif"
  13.    FontSize        =   8.25
  14.    FontStrikethru  =   0   'False
  15.    FontUnderline   =   0   'False
  16.    Height          =   6165
  17.    Icon            =   PFFDISP.FRX:0000
  18.    Left            =   105
  19.    LinkMode        =   1  'Source
  20.    LinkTopic       =   "Form2"
  21.    MinButton       =   0   'False
  22.    ScaleHeight     =   5760
  23.    ScaleWidth      =   9480
  24.    Top             =   375
  25.    Width           =   9600
  26.    Begin TextBox Display 
  27.       BackColor       =   &H00C0C0C0&
  28.       FontBold        =   0   'False
  29.       FontItalic      =   0   'False
  30.       FontName        =   "Terminal"
  31.       FontSize        =   9
  32.       FontStrikethru  =   0   'False
  33.       FontUnderline   =   0   'False
  34.       Height          =   5325
  35.       Left            =   0
  36.       MultiLine       =   -1  'True
  37.       ScrollBars      =   3  'Both
  38.       TabIndex        =   0
  39.       Top             =   450
  40.       Width           =   9495
  41.    End
  42.    Begin CommandButton PrintMe 
  43.       BackColor       =   &H00808080&
  44.       Caption         =   "Print &Me"
  45.       Height          =   375
  46.       Left            =   1440
  47.       TabIndex        =   2
  48.       Top             =   45
  49.       Width           =   1215
  50.    End
  51.    Begin CommandButton Finished 
  52.       BackColor       =   &H00808080&
  53.       Caption         =   "&Finished"
  54.       Height          =   375
  55.       Left            =   120
  56.       TabIndex        =   1
  57.       Top             =   45
  58.       Width           =   1215
  59.    End
  60. ' This sub works well only with VGA displays.  For EGA
  61. ' displays, you will want to modify the backcolor
  62. ' properties for the form and controls, and avoid this
  63. ' procedure.
  64. Sub BorderBox2 (Source As Control, Action As Integer)
  65.     BLeft% = Source.Left - 10     ' Get coordinates
  66.     BTop% = Source.Top - 10
  67.     BWide% = Source.Width + 28
  68.     BHigh% = Source.Height + 28
  69.     ' Action TRUE means draw, FALSE means erase
  70.     If Action Then
  71.     ' Draw a recessed border around Source control
  72.     Line (BLeft%, BTop%)-Step(BWide%, -2), 0, B
  73.     Line -Step(-2, BHigh%), RGB(255, 255, 255), B
  74.     Line -Step(-BWide%, 2), RGB(255, 255, 255), B
  75.     Line -Step(2, -BHigh%), 0, B
  76.     Else
  77.     ' Erase border around Source control
  78.     Line (BLeft%, BTop%)-Step(BWide%, 0), Backcolor
  79.     Line -Step(0, BHigh%), Backcolor
  80.     Line -Step(-BWide%, 0), Backcolor
  81.     Line -Step(0, -BHigh%), Backcolor
  82.     End If
  83. End Sub
  84. Sub Display_GotFocus ()
  85.     Display.Text = ""
  86.     ChDrive Selection.Drive1.Drive
  87.     ChDir Selection.File1.Path
  88.     MyFile$ = Selection.File1.FileName
  89.     If MyFile$ <> "" Then
  90.     Open MyFile$ For Input As #1 Len = 4096
  91.     If LOF(1) > 32000 Then
  92.         Msg$ = "You will only be able to view the first" + Chr$(13)
  93.         Msg$ = Msg$ + "30K of the file"
  94.         MsgBox Msg$, 48, "File Too Large"
  95.         Do Until Len(Scratch$) >= 32000
  96.         Line Input #1, NextLine$
  97.         Scratch$ = Scratch$ + NextLine$ + Chr$(13) + Chr$(10)
  98.         Loop
  99.     Else
  100.         Do Until EOF(1)
  101.         Line Input #1, NextLine$
  102.         Scratch$ = Scratch$ + NextLine$ + Chr$(13) + Chr$(10)
  103.         Loop
  104.     End If
  105.     Close #1
  106.     Display.Text = Scratch$
  107.     Viewer.Caption = "Viewing " + MyFile$ + " - Size =" + Str$(Len(Scratch$))
  108.     Else
  109.     Beep
  110.     Msg$ = "No File Specified"
  111.     MsgBox Msg$, 48, "I Need a File!"
  112.     Viewer.Hide
  113.     End If
  114. End Sub
  115. Sub Display_KeyPress (KeyAscii As Integer)
  116.     Beep
  117.     KeyAscii = 0
  118. End Sub
  119. Sub Finished_Click ()
  120.     Viewer.Hide
  121.     Unload Viewer
  122. End Sub
  123. Sub Form_GotFocus ()
  124.     Display.Text = ""
  125.     Display_GotFocus
  126. End Sub
  127. Sub Form_Paint ()
  128.     BorderBox2 Display, True
  129. End Sub
  130. Sub Form_Resize ()
  131.     Display.Move 100, 446, Viewer.ScaleWidth - 200, Viewer.ScaleHeight - 546
  132. End Sub
  133. Sub PrintMe_Click ()
  134.     Viewer.Caption = "Printing ..."
  135.     Viewer.MousePointer = 11
  136.     FormatFile MyFile$
  137.     Viewer.MousePointer = 0
  138.     Unload Viewer
  139. End Sub
  140.